import unittest
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


class MyTestCase(unittest.TestCase):
    def setUp(self):
       self.driver=webdriver.Chrome()
       self.base_url="http://192.168.11.8:8081"
       self.driver.implicitly_wait(20)
       self.driver.maximize_window()
    def tearDown(self):
        sleep(2)
        self.driver.quit()

    def testWJSC(self):
        self.driver.get(self.base_url+"/SeleniumDemo/fileupload.html")
        a=self.driver.find_element_by_name("username")
        a.clear()
        a.send_keys("xx")
        s=self.driver.find_element_by_name("pic")
        s.send_keys("D:/tp/t1.jpg")
        e=self.driver.find_element_by_xpath("/html/body/form/input[3]")
        e.click()
        self.assertIn("成功",self.driver.page_source)